Any of these file names look familiar?
code_v1.R
code_v1b_add_plot.R
code_v1b_add_plot_FINAL.R
code_v1b_add_plot_FINAL_FINALv2_sept2020.R
code_v1b_add_plot_FINAL_FINALv2_sept2020_Maria_edits.R
Have a system
Best practices
Standardized naming convention
0.1-ptg-exciting-report.txt
0.2-ptg-exciting-report.txt
1.0-ptg-exciting-report.txt (finalised version)
1.1-ptg-exciting-report.txt (revision)
<project-name>
| CHANGELOG.txt
└───current
│ │ code.R
| | report.txt
└───2023-06-13
| | code.R
| | report.txt
└───2023-06-12
| | code.R
| | report.txt
Versioning manually requires a lot of self-discipline
Combining versions manually is hard work
Might need a version control system such as Git
Widely used Version Control System
Automatically tracks changes in your project
Changes by multiple people can be combined into a single file
Backups stored securely & remotely
Think about e-mail… we could host our own e-mail server, but that’s usually too much effort
Git is like e-mail
GitLab & GitHub are like gmail or yahoo
There are other git hosting services
Today we’ll focus on GitHub
GitHub uses personal access tokens (PATs) as a secure method of authentication
A PAT is an auto-generated strong passphrase (not ‘monkey123’!)
The user can set an automatic expiry date and different permissions for each token
This guide explains how to set one up in GitHub (make sure to select ‘repo’ when setting the scopes)
There are a couple of different ways that we can start using a Git repository:
Downloads a copy of that repository to your machine
Takes the latest snapshot available (all of the files) from GitHub
By default saved in a folder with the same name as the repository
Usually when working you would save your files
In Git, instead of just saving, we save and commit
Commit takes a snapshot of all your files
Not all changes are included in a commit
Add files to the staging area before committing
We are going to:
Edit & save some files in our working directory
Add these changes to the staging area
Commit the changes in the staging area to our local repository
Now we are going to:
Project management
Continuous Integration
Automated deployments
Security